#include "delay.h"
#include <stdint.h>

void Delay1ms()		//@11.0592MHz
{
	unsigned char i, j;

	//_nop_();

	i = 2;
	j = 199;
	do
	{
		while (--j);
	} while (--i);
}

void Delay10ms()		//@11.0592MHz
{
	unsigned char i, j;

	i = 18;
	j = 235;
	do
	{
		while (--j);
	} while (--i);
}

void Delay100ms()		//@11.0592MHz
{
	unsigned char i, j;

	i = 180;
	j = 73;
	do
	{
		while (--j);
	} while (--i);
}


void delayms(uint16_t ms)
{
        ms = ms /3;
        uint16_t i;
        uint16_t ms100 = ms/100;
        uint16_t ms10 = ms%100/10;
        uint16_t ms1 = ms%10;
        for(i = 0; i < ms100; i++) {
                Delay100ms();
        }
        for(i = 0; i < ms10; i++) {
                Delay10ms();
        }
        for(i = 0; i < ms10; i++) {
                Delay1ms();
        }
}

void Delay1us()		//@11.0592MHz
{
	
}


void delayus(uint16_t us)
{
        uint16_t i;
        for(i = 0; i < us; i++) {
                Delay1us();
        }
}

void _nop_(void)
{
	
}